﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="Studio77.GuessTheWordsWin8.Pages.StagePage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Studio77.GuessTheWordsWin8.Pages"
    xmlns:common="using:Studio77.GuessTheWordsWin8.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <DataTemplate x:Key="StageItemDataTemplete">
            <Grid HorizontalAlignment="Left" Width="300" Height="90" Background="#FFA2A2A2" Margin="5" Tapped="Grid_Tapped">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="47*"/>
                    <ColumnDefinition Width="154*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Border BorderBrush="Black" HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="70" Background="#FFFF9700">
                    <TextBlock x:Name="txtStageIndex" HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding StageIndex}" VerticalAlignment="Center" FontSize="29.333" FontWeight="Bold" Foreground="White"/>
                </Border>
                <Grid Grid.Column="1" HorizontalAlignment="Left" Height="90" VerticalAlignment="Top" Width="230">
                    <TextBlock x:Name="txtCompleteTip" Visibility="{Binding IsLocked, Converter={StaticResource lockToVisibilityConverter2}}" HorizontalAlignment="Left" Margin="6,6,0,0" TextWrapping="Wrap" Text="完成情况" VerticalAlignment="Top" Foreground="#FFE8E8E8" FontSize="18.667" Width="39"/>
                    <TextBlock x:Name="txtCompleteCount" Visibility="{Binding IsLocked, Converter={StaticResource lockToVisibilityConverter2}}" HorizontalAlignment="Right" TextWrapping="Wrap" Text="{Binding CompleteCount}" VerticalAlignment="Bottom" FontSize="40" Margin="0,0,6,0" Foreground="Black"/>
                    <TextBlock x:Name="txtLock" Visibility="{Binding IsLocked, Converter={StaticResource lockToVisibilityConverter1}}" HorizontalAlignment="Right" TextWrapping="Wrap" Text="未解锁" VerticalAlignment="Bottom" FontSize="40" Margin="0,0,5,0" Foreground="#FF626600"/>
                </Grid>
            </Grid>
        </DataTemplate>

    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}" Background="{StaticResource NormalBackground}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}" Text="选择游戏关卡"/>
            <TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="353,69,0,0" TextWrapping="Wrap" Text="完成10个词条，即可解锁下一关卡" VerticalAlignment="Top" FontSize="29.333" Foreground="White"/>
        </Grid>
        <GridView CanDragItems="False" CanReorderItems="False" SelectionMode="None" x:Name="gridViewStageItems" ItemsSource="{Binding}" Margin="0,20,0,10" Grid.Row="1" ItemTemplate="{StaticResource StageItemDataTemplete}"/>
        <Rectangle Fill="#FF9C0000" Height="23" VerticalAlignment="Top" StrokeThickness="0"/>
        <Rectangle Fill="#FF9C0000" StrokeThickness="0" Margin="0" VerticalAlignment="Bottom" Height="10" Grid.Row="1"/>
        <Viewbox HorizontalAlignment="Right" Width="346" Height="88" VerticalAlignment="Top" Margin="0,36,16,0">
        	<Grid Height="120" Width="472">
        		<Image Margin="0,4,356,0" Source="ms-appx:///Images/title_feng.png" Stretch="Fill" Width="116" Height="116"/>
        		<Image Margin="116,2,238,0" Source="ms-appx:///Images/title_kuang.png" Stretch="Fill" Width="118" Height="118"/>
        		<Image Margin="233,0,121,0" Source="ms-appx:///Images/title_tian.png" Stretch="Fill" Width="118" Height="120"/>
        		<Image Margin="354,2,0,0" Source="ms-appx:///Images/title_zi.png" Stretch="Fill" Width="118" Height="118"/>

        	</Grid>

        </Viewbox>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
